package cc.bailongma.me;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class FindPwd2Activity extends Activity implements View.OnClickListener{
	private EditText et_new_number;
	private EditText et_confirme_new_number;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_find_pwd2);
		setView();
	}

	private void setView() {
		et_new_number=(EditText) findViewById(R.id.et_new_number);
		et_confirme_new_number=(EditText) findViewById(R.id.et_confirme_new_number);
		TextView tv_login_phone=(TextView) findViewById(R.id.tv_login_phone);
		tv_login_phone.setText(getIntent().getStringExtra("phone"));
		findViewById(R.id.tv_submit).setOnClickListener(this);
		findViewById(R.id.tv_back).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_submit:
			String newPwd=et_new_number.getText().toString().trim();
			String confirme=et_confirme_new_number.getText().toString().trim();
			if(TextUtils.isEmpty(newPwd)){
				et_new_number.setError("手机不能为空");
				return;
			}
			if(TextUtils.isEmpty(confirme)){
				et_confirme_new_number.setError("密码不能为空");
				return;
			}
			if(!newPwd.equals(confirme)){
				et_confirme_new_number.setError("密码不一致");
				return;
			}
			Toast.makeText(this, "请重新登录", 0).show();
			startActivity(new Intent(this,LoginActivity.class));finish();
			break;
		case R.id.tv_back:
			startActivity(new Intent(this,LoginActivity.class));finish();
			break;
	
		}
		
	}
	
}
